package org.finesys.common.hazelcast.core.support;

import com.hazelcast.map.IMap;
import lombok.RequiredArgsConstructor;
import org.finesys.common.hazelcast.core.base.DistributedMap;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

@RequiredArgsConstructor
public class HazelcastMap<K, V> implements DistributedMap<K, V> {

    private final IMap<K, V> iMap;

    @Override
    public void put(K k, V v) {
        iMap.put(k, v);
    }

    @Override
    public V get(K k) {
        return iMap.get(k);
    }

    @Override
    public V replace(K k, V v) {
        return iMap.replace(k, v);
    }

    @Override
    public void delete(K k) {
        iMap.delete(k);
    }

    @Override
    public Collection<K> keys() {
        return iMap.keySet();
    }

    @Override
    public Collection<V> values() {
        return iMap.values();
    }

    @Override
    public Set<Map.Entry<K, V>> entrySet() {
        return iMap.entrySet();
    }

    @Override
    public void clear() {
        iMap.clear();
    }
}
